# CPBMI Python Homework 3-1
# Programmed by Seunghwan Kim

# 1)

aa_weight = {'A':89, 'R':174, 'D':133, 'N':132, 'C':121, 'E':147, 'Q':146, 'G':75, 'H':155, 'I':131, 'L':131, 'K':146, 'M':149, 'F':165, 'P':115, 'S':105, 'T':119, 'W':204, 'Y':181, 'V':117}

# 2)

aa_sequence = '''MDLIPNLAVETWLLLAVSLVLLYLYGTRTHGLFKRLGIPGPTPLPLLGNVLSYRQGLWKFDTECYKKYGK
MWGTYEGQLPVLAITDPDVIRTVLVKECYSVFTNRRSLGPVGFMKSAISLAEDEEWKRIRSLLSPTFTSG
KLKEMFPIIAQYGDVLVRNLRREAEKGKPVTLKDIFGAYSMDVITGTSFGVNIDSLNNPQDPFVESTKKF
LKFGFLDPLFLSIILFPFLTPVFEALNVSLFPKDTINFLSKSVNRMKKSRLNDKQKHRLDFLQLMIDSQN
SKETESHKALSDLELAAQSIIFIFAGYETTSSVLSFTLYELATHPDVQQKLQKEIDAVLPNKAPPTYDAV
VQMEYLDMVVNETLRLFPVAIRLERTCKKDVEINGVFIPKGSMVVIPTYALHHDPKYWTEPEEFRPERFS
KKKDSIDPYIYTPFGTGPRNCIGMRFALMNMKLALIRVLQNFSFKPCKETQIPLKLDTQGLLQPEKPIVL
KVDSRDGTLSGE'''

aa_sequence = aa_sequence.replace('\n', '')

# 3)

total_aa_weight = 0
for i in aa_sequence:
    total_aa_weight = total_aa_weight + aa_weight[i]

# 4)
molecular_weight = total_aa_weight - (18 * (len(aa_sequence) -1))
print "Total molecular weight : %d" % (molecular_weight)